/*
 * Copyright (c)e 2024-2024.Powered by 清明雨揽月
 * This software is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *          http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY
 * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

//
// Created by Nefilibata on 2024/8/13.
//

#ifndef AL_GRAPH_H
#define AL_GRAPH_H

#define MAX_VERTEX_NUM 100

typedef struct ARC_NODE
{
    int adjvex;
    ARC_NODE* next_arc;
} arc_node;

typedef struct V_NODE
{
    char data;
    ARC_NODE* first_arc;
} v_node, adj_list[MAX_VERTEX_NUM];

typedef struct AL_GRAPH
{
    adj_list vertices;
    int vexnum, arcnum;
} al_graph;


class ALGraph
{
private:
    bool adj_acent(const ARC_NODE* x, const ARC_NODE* y) const;
    void neighbors(const ARC_NODE* x) const;
    void insert_vertex(const ARC_NODE* x) const;
    void delete_vertex(const ARC_NODE* x) const;
    void add_edge(const ARC_NODE* x, const ARC_NODE* y) const;
    void remove_edge(const ARC_NODE* x, const ARC_NODE* y) const;
    ARC_NODE first_neighbor(const ARC_NODE* x) const;
    ARC_NODE next_neighbor(const ARC_NODE* x) const;
    int get_edge_value(const ARC_NODE* x, const ARC_NODE* y) const;
    int set_edge_value(const ARC_NODE* x, const ARC_NODE* y, int value) const;

public:
    void operate() const;
};


#endif //AL_GRAPH_H
